package com.bdqn.service.impl;

import ch.qos.logback.core.util.StringUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bdqn.mapper.SysUserMapper;
import com.bdqn.pojo.SysUser;
import com.bdqn.service.SysUserService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【sys_user】的数据库操作Service实现
* @createDate 2024-09-13 19:20:03
*/
@Service("SysUserService")

public class SysUserServiceImpl implements SysUserService {

    @Resource
    private SysUserMapper userMapper;

    @Override
    public SysUser login(String usrName, String usrPassword) {
        if (StringUtil.isNullOrEmpty(usrName) || StringUtil.isNullOrEmpty(usrPassword)) {
            return null;
        }
        QueryWrapper<SysUser> qw = new QueryWrapper<>();
        qw.eq("usr_name", usrName);
        qw.eq("usr_password", usrPassword);
        return userMapper.selectOne(qw);
    }

    @Override
    public SysUser addUser(SysUser user) {
        return null;
    }

    @Override
    public void deleteUser(Long usrId) {
//        QueryWrapper<SysUser> qw = new QueryWrapper<>();
//        qw.eq("usr_id", usrId);
//        userMapper.selectOne(qw);
    }

    @Override
    public SysUser updateUser(SysUser user) {
//        return userMapper.selectOne(new QueryWrapper<>(user));
        return null;
    }

    @Override
    public SysUser getUser(Long usrId) {
        QueryWrapper<SysUser> qw = new QueryWrapper<>();
        qw.eq("usr_id", usrId);
        return userMapper.selectOne(qw);
    }

    @Override
    public List<SysUser> findAllUsers() {
        return null;
    }
}




